Get OTP Message
Welcome to the Post Convert Text to Speech API!
Ever wanted to turn your OTP messages into clear, crisp voice prompts? This API has your back. It's designed to simplify communication, helping you convert text into speech, ready to deliver important one-time passcodes (OTPs) or alerts to your users.
Let’s dive in and get your app talking!
Endpoint
To make the magic happen, send a request to this endpoint:
https://api.betatel.com/api/v1/tts/otp?language=bs&pauseDigit=50&pausePhrase=200&repeats=2&text=Use code 51550 to change credentials for your account
Parameter | Value | Description |
---|---|---|
language | bs | Sets the language (Bosnian in this case). |
pauseDigit | 50 | Pauses slightly between digits (50ms). |
pausePhrase | 200 | Adds a brief pause between phrases (200ms). |
repeats | 2 | Repeats the message twice to ensure clarity. |
text | Use code 51550... | The message you want to convert to speech. |
Headers
Before you send off that request, don’t forget the headers:
Param | Value | Description |
---|---|---|
x-api-key | {{x-api-key}} | Your unique API key for secure access. |
x-user-id | {{x-user-id}} | Your user identifier for added security and tracking. |
Let's Get Coding!
Time to roll up your sleeves and make this happen. Choose your language and copy-paste the snippets below:
- cUrl
- Python
- Node.js
- PHP
- Java
- C#
curl --location 'https://dev.api.betatel.com/api/v1/tts/otp?language=bs&pauseDigit=50&pausePhrase=200&repeats=2&text=Use%20code%2051550%20to%20change%20credentials%20for%20your%20account' \
--header 'x-user-id: 6757f3ffb5e62f0ce0e513a2' \
--header 'x-api-key: ••••••'
import http.client
conn = http.client.HTTPSConnection("dev.api.betatel.com")
payload = ''
headers = {
'x-user-id': '6757f3ffb5e62f0ce0e513a2',
'x-api-key': '••••••'
}
conn.request("GET", "/api/v1/tts/otp?language=bs&pauseDigit=50&pausePhrase=200&repeats=2&text=Use%20code%2051550%20to%20change%20credentials%20for%20your%20account", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://dev.api.betatel.com/api/v1/tts/otp?language=bs&pauseDigit=50&pausePhrase=200&repeats=2&text=Use code 51550 to change credentials for your account',
headers: {
'x-user-id': '6757f3ffb5e62f0ce0e513a2',
'x-api-key': '••••••'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://dev.api.betatel.com/api/v1/tts/otp?language=bs&pauseDigit=50&pausePhrase=200&repeats=2&text=Use%20code%2051550%20to%20change%20credentials%20for%20your%20account',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'x-user-id: 6757f3ffb5e62f0ce0e513a2',
'x-api-key: ••••••'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://dev.api.betatel.com/api/v1/tts/otp?language=bs&pauseDigit=50&pausePhrase=200&repeats=2&text=Use%20code%2051550%20to%20change%20credentials%20for%20your%20account")
.header("x-user-id", "6757f3ffb5e62f0ce0e513a2")
.header("x-api-key", "••••••")
.asString();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://dev.api.betatel.com/api/v1/tts/otp?language=bs&pauseDigit=50&pausePhrase=200&repeats=2&text=Use code 51550 to change credentials for your account");
request.Headers.Add("x-user-id", "6757f3ffb5e62f0ce0e513a2");
request.Headers.Add("x-api-key", "••••••");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Response
JSON Schema:
🎉 Congratulations – You're All Set!
You've successfully integrated the Text-to-Speech OTP API into your application. Now, your users can receive crystal-clear voice prompts, ensuring seamless communication and enhanced security.
🚀 What’s Next?
Test & Optimize
– Try different languages, pauses, and repetitions to fine-tune the experience.Scale Up
– Expand this feature across your user base for greater accessibility.More
– Dive into other CarrierIQ APIs to enhance your platform even further. 🔧 Need Help? Our support team is ready to assist you every step of the way.
✨ Happy coding, and may your apps always speak clearly!